package cn.geracomium.util.service.abs;

import java.util.HashMap;
import java.util.Map;

public abstract class AbstractService {

    protected static final Integer PAGE_SIZE = 2;

    public Map<String, Object> paramConverterMap(long currentPage, int lineSize, String column, String keyWord) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("start", (currentPage - 1) * lineSize);
        map.put("lineSize", lineSize);
        if (!(column == null || "".equals(column))) {
            map.put("column", column);
        }
        if (!(keyWord == null || "".equals(keyWord))) {
            map.put("keyWord", "%" + keyWord + "%");
        }
        return map;
    }

    public Map<String, Object> paramConverterMap(long currentPage, int lineSize, String keyWord) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("start", (currentPage - 1) * lineSize);
        map.put("lineSize", lineSize);
        if (!(keyWord == null || "".equals(keyWord))) {
            map.put("keyWord", "%" + keyWord + "%");
        }
        return map;
    }
} 
